package icom.acm.action;

import icom.acm.bean.T_USER;
import icom.acm.bean.T_USERSET;
import icom.acm.form.UserSetForm;
import icom.acm.util.StaticData;
import icom.acm.util.json.JSONMsg;

public class UserSetAction extends Action {
	private UserSetForm form;
	
	public void test(){
		JSONMsg jmsg = null;
		T_USER user = checkUser();
		if (user == null){
			// todo：提示信息
			jmsg = new JSONMsg(false,"用户未登录!");
			out.print(jmsg);
			return ;
		}
		System.out.println(form.getA());
		jmsg = new JSONMsg(false,"发送数据存入数据库:"+form.getA());
		out.print(jmsg);
	}
	
	public void getUserSetInfo(){
		// 必要的
		JSONMsg jmsg = null;
		T_USER user = checkUser();
		if (user == null){
			// todo：提示信息
			jmsg = new JSONMsg(false,"用户未登录!");
			out.print(jmsg);
			return ;
		}
		String jsons = "";
		for (int i=0;i<StaticData.USERSETLIST.size(); i++){ 
			T_USERSET us = StaticData.USERSETLIST.get(i);
			System.out.println(us.toJson());			
			String json = us.toJson();
			if(i>0) jsons = jsons + ",";
			jsons = jsons + json;			
		}
		
		// todo：得到数据 成功返回
		System.out.println("hello");
		jmsg = new JSONMsg(true,"hello");
		jmsg.include(jsons);
		out.print(jmsg);
	}

	public UserSetForm getForm() {
		return form;
	}

	public void setForm(UserSetForm form) {
		this.form = form;
	}
	
	
}
